/**
 * 
 */
package com.maywide.jdp.system.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.maywide.jdp.system.servlet.ViewAttribute;

/**
 * @author luoyang
 */
public class RequestViewBeanNameInterceptor extends HandlerInterceptorAdapter {
	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		String beanViewName = (String) request.getAttribute(ViewAttribute.VIEW_BEAN_NAME);
		if(beanViewName != null)
			modelAndView.setViewName(beanViewName);
	}
}
